{include file="/wap/public/top" /}
<!--左侧menu部分end-->
{include file="/wap/public/layui" /}
<link rel="stylesheet" type="text/css" href="__indexwap__/css/login.css">
 <div class="wrap"> 
  
<div class="header"> 
 
</div>
  <div class="full-line"></div>
   <div class="main container page-login">
    <div class="row">
     <div class="login">
      <div class="hint">
       <div class="alert alert-danger alert-dismissable" id="errs" style="display:none;"></div>
      </div>
      <div class="password"> 
       <form id="theForm"  method="post" >
        <div class="input-group">
         <span class="input-group-addon"><i class="fa fa-user"></i></span>
         <input type="text" name="username" id="username" autocomplete="off" style="    height: 46px;" placeholder="用户名或手机号码" class="form-control input-lg">
        </div>
        <div class="input-group">
         <span class="input-group-addon"><i class="fa fa-lock"></i></span>
         <input type="password" name="password" id="password" placeholder="密码"style="    height: 46px;" autocomplete="off" class="form-control input-lg">
        </div>
        <div class="input-group buttons">
         <button type="button" id="login" class="btn btn-orange">立即登录</button>
         <span><a href="{:url('index/zhpwd')}">忘记密码？</a></span>
        </div>
       </form>
       <div class="space1"></div>
       <!--<h3 class="fast-reg"><a href="{:url('index/reg')}" class="register">没有账号？立即注册</a></h3>-->
      </div>
     </div>
    </div>
   </div>
  </div>
<script>
$(function(){
 function loginsubmit(){
                var username=true;
                var password=true;
                var vertify=true;

                if($('#theForm input[name=username]').val() == ''){
                   // $('#error').html('<span class="error">用户名不能为空!</span>');
					msg('用户名不能为空!');
                    $('#theForm input[name=name]').focus();
                    username = false;
                    return false;
                }

                if($('#theForm input[name=password]').val() == ''){
                    //$('#error').html('<span class="error">密码不能为空!</span>');
					msg('密码不能为空!');
                    $('#theForm input[name=password]').focus();
                    password = false;
                    return false;
                }

               /* if($('#theForm input[name=vertify]').val() == ''){
                    //$('#error').html('<span class="error">验证码不能为空!</span>');
					msg('验证码不能为空!');
                    $('#theForm input[name=vertify]').focus();
                    vertify = false;
                    return false;
                }*/

                if(vertify && $('#theForm input[name=username]').val() != '' && $('#theForm input[name=password]').val() != ''){
                    $.ajax({
                        async:false,
                        url:"{:url('index/login')}",
                        data:{'name':$('#theForm input[name=username]').val(),'pwd':$('#theForm input[name=password]').val()},//'vertify':$('#theForm input[name=vertify]').val()
                        type:'post',
                        dataType:'json',
                        success:function(res){
						console.log(res);
                            if(res.status != 1){
                                //$('#error').html('<span class="error">'+res.msg+'!</span>');
								msg(res.msg);
                                fleshVerify();
                                username=false;
                                password=false;
                                return false;
                            }else{
                                top.location.href = res.url;
                            }
                        },
                        error : function(XMLHttpRequest, textStatus, errorThrown) {
							console.log(XMLHttpRequest.responseText);
                           /// $('#error').html('<span class="error">网络失败，请刷新页面后重试!</span>');
						   msg('网络失败，请刷新页面后重试!');
                        }
                    });
                }else{
                    return false;
                }
            }

          
            $('#login').on('click',function(){
				
                loginsubmit();
            });
			
			
            //回车提交
            $(document).keyup(function(event){
                if(event.keyCode ==13){
                   
                        loginsubmit();
                   
                }
            });
			function fleshVerify(){
            $('#imgVerify').attr('src','{:captcha_src()}');//重载验证码
        }
        });
</script>
  {include file="/wap/public/hder" /}
